<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .box{
            width: 500px;
            height: 500px;
            background-color: red;
        }
    </style>
</head>
<body>
<div class="box">
<p>dhvknls</p>
    <img src="www.baidu.com">
</div>
<script type="text/html">
    window.onload = function () {
            //node atrribute
        var  box = document.getElementsByClassName("box")[0];
        var boxCopy =   box.cloneNode(true);
        console.log(boxCopy);
        document.body.appendChild(boxCopy);

    }
</script>
<script>
    window.onload = function () {
        // 节点的属性
        var img = document.getElementsByTagName("img")[0];
        //1.获取节点属性
        console.log(img.getAttribute("src"));
        console.log(img.src);
        //set node 属性
        img.setAttribute('src',"img1,img2");
        //delete 节点属性
        img .removeAttribute('src');
    }
</script>
</body>
</html>